package example.controller;


import example.aop.NewExpResponse;
import example.constant.ResponseEnum;
import example.handler.AdminUserHandler;
import example.param.AdminUserDeleteParam;
import example.param.AdminUserEditParam;
import example.param.AdminUserLoginParam;
import example.param.AdminUserSignInParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * Created by snksnk1091 on 2017/8/23.
 */
@Controller
@RequestMapping("/AdminUser")
public class AdminUserController {

    @Autowired
    private AdminUserHandler adminUserHandler;

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/adminUserSignIn")
    public Object adminUserSignIn(@RequestBody AdminUserSignInParam param){
        adminUserHandler.adminUserSignIn(param);
        return ResponseEnum.SUCCESS;
    }

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/adminUserEdit")
    public Object adminUserEdit(@RequestBody AdminUserEditParam param){
        adminUserHandler.adminUserEdit(param);
        return ResponseEnum.SUCCESS;
    }

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/adminUserDelete")
    public Object adminUserDelete(@RequestBody AdminUserDeleteParam param){
        adminUserHandler.adminUserDelete(param);
        return ResponseEnum.SUCCESS;
    }

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/getAdminUser/{id}")
    public Object getAdminUser(@PathVariable int id){
        return adminUserHandler.getAdminUser(id);
    }

    @NewExpResponse
    @ResponseBody
    @RequestMapping("/adminUserLogin")
    public Object adminUserLogIn(@RequestBody AdminUserLoginParam param, HttpSession httpSession){
        return adminUserHandler.adminUserLogin(param, httpSession);
    }
}
